﻿using System;
using System.Web.UI;
using Bingosoft.Web.Utils;
using HHMMS.Core.Service;
using HHMMS.Core.Model;

namespace HHMMS.UI.Modules.PlanManager
{
    public partial class PurchasePlanDocEdit : FormPage
    {
        private readonly PurchasePlanDocService _purchasePlanDocService = ObjectHelper.GetObject<PurchasePlanDocService>();

        protected void Page_Load(object sender, EventArgs e)
        {            
            if (!IsPostBack && SmartForm.IsEdit())
            {
                SmartForm.Fill(container, "PlanManager.PurchasePlanDoc.Get");
            }
        }
        
        protected void SaveOrUpdatePurchasePlanDoc(object sender, EventArgs e)
        {
            PurchasePlanDoc purchasePlanDoc = SmartForm.GetEntity<PurchasePlanDoc>(container);
            this._purchasePlanDocService.SaveOrUpdatePurchasePlanDoc(purchasePlanDoc);

            ScriptHelper.CloseDialog(this, "true");
        }
    }
}